package com.wd.jetpack.util

import androidx.annotation.IdRes
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager

/**
 * fragment工具类<BR>
 *
 * @author W4255
 * @version [V0.0.1, 2021/6/26]
 * @Description: NA
 */
object FragmentUtils {
    /**
     * Activity添加Fragment
     */
    inline fun addFragment(supportFragmentManager: FragmentManager, @IdRes containerViewId: Int, fragment: Fragment) {
        supportFragmentManager.beginTransaction().add(containerViewId, fragment).commit()
    }

    /**
     * Activity添加Fragment
     */
    inline fun replaceFragment(supportFragmentManager: FragmentManager, @IdRes containerViewId: Int, fragment: Fragment) {
        supportFragmentManager.beginTransaction().replace(containerViewId,
                fragment).commit()
    }

}